const express = require('express');
const router = express.Router();
const bookController = require('../controllers/bookController');
const expressJoi = require('@escook/express-joi');
const { findBookCheck } = require('../utils/check');
const { updateBookCheck } = require('../utils/check');
const { addBookCheck } = require('../utils/check');

// 查询图书
router.get('/find', expressJoi(findBookCheck), bookController.listBook);

// 编辑图书
router.get('/update', expressJoi(updateBookCheck), bookController.updateBookById);

// 删除图书
router.get('/delete', bookController.deleteBookById);

// 添加图书
router.get('/add', expressJoi(addBookCheck), bookController.addBook);

// 获取全部图书
router.get('/bookData', bookController.bookData)

module.exports = router;